home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
umich
/
music
/
musgfa.zoo
/
musedt.lst
< prev
next >
Wrap
File List
|
1992-12-24
|
54KB
|
2,046 lines
' musedt.gfa 6 June 1991: graphics envelope added 3 may 92
' music scoring software
' programmed by Seymour Shlien in GFA Basic 3.5 on my 1040STE
' 624 Courtenay Avenue / Ottawa, Ontario, Canada K2A 3B5
' The program is public domain and not for commercial use.
DIM note_yposition%(52) ! vertical of natural notes on staff
DIM flat_yposition%(22),sharp_yposition%(22) ! vertical position of other notes
DIM length_sprite%(12) !mapping of note time value with its sprite number
DIM rest_sprite%(12) !mapping of rest time value with its sprite number
DIM sharp_key_to_letter$(13) !mapping of pitch code (1 to 12) to letter code
DIM flat_key_to_letter$(13) ! mapping of pitch code to letter code (c,d,e...g)
DIM duration_to_text$(17) !duration code (0 to 12) to symbol (eg HN.)
DIM keysig_to_text$(15) !key signature code (1 to 12) to text
DIM assumed_accidental%(12) ! indicates whether note must be preceded by #,b
DIM nat_keys%(15) !keys to be printed as natural as function of key signature
DIM shrp_keys%(15) !keys assumed to be accidentals as function of keysig
DIM sharp_sig_ypos%(7),flat_sig_ypos%(7) ! treble and bass sharp sequence
DIM notes_to_microbeats%(12) ! duration code (1 - 12) to microbeat value
DIM elapsed_microbeats%(3) !number of microbeats for each voice (bar lines)
DIM sprite$(30)
DIM seq%(3) !note sequence number in each voice during play
DIM micro_beat%(3) ! accumulated microbeats for voice (for play)
DIM next_event%(3) ! time for next note to sound for voice (for play)
DIM play_stop%(3) ! kounter for stop playing -used in cue
DIM note_tick%(3) ! time a note was sounded. Used for envelope
DIM tone_envel%(300) ! loudness envelope 1 to 100 for each voice
DIM volum(3),decay(3)
DIM voice_end_flag%(3) ! flag to signal end of voice
DIM note%(3),duration%(3),draw_flag%(3) !last notes sounded
DIM black_keys%(5) ! position of black keys on keyboard
REM white key - black key to pitch code converter
DIM white_keycod%(7),black_keycod%(7),white_key_decoder%(32),black_key_decoder%(21)
DIM x1%(50),x2%(50),y1%(50),y2%(50) ! for mouse sensitive zones
DIM kount%(2),vclen%(2),repeat_sign%(2),repeat_count%(2)
REM memory for storing music
DIM tnote&(2,1000),mubeat%(3)
DIM last_note_duration%(3) !need it if we correct an error with right button
REM if USESHARPS = 1 then sharps are used instead of flats
usesharps%=0
DEFMOUSE 0
CLS
rez%=XBIOS(4)
IF rez%<>1
ALERT 3," Please switch to | medium resolution! ",1,"Oops",b%
STOP
ENDIF
CLS
IF usesharps%<>1
usesharps%=1
ELSE
usesharps%=0
ENDIF
key_sig%=8 ! key signature for c major (a minor)
beats_per_bar%=4
beat_size%=4
bar_length%=beats_per_bar%*notes_to_microbeats%(beat_size%)
next_bar_line%=bar_length%
next_key_sig%=8
tnt%=11 ! assume quarter note sprite
staff_yshift%=-25 !vertical position to draw treble and bass staff
voic%=1
voic1%=voic%-1
speed%=50
@read_music_data
@load_note_sprites
@initialize_note_table
volum(0)=11
volum(1)=10
volum(2)=10
decay(0)=0.08
decay(1)=0.09
decay(2)=0.13
FOR i%=0 TO 2
offset=volum(i%)
attenuation=decay(i%)
@make_tone_envelope(i%,offset,attenuation)
NEXT i%
@draw_musedt_screen
@reset
tlen%=4
@switch_note_duration
note_xcoor%=40
' run till infinity
FOR i%=1 TO 500000
@decode_mouse_key
PAUSE 10
IF write%=1
IF klick%=1 !appending or overwriting next note
kount%(voic1%)=kount%(voic1%)+1
tnote&(voic1%,kount%(voic1%))=nte%+tlen%*256
last_note_duration%(voic1%)=tlen%
IF tlen%<13
elapsed_microbeats%(voic1%)=elapsed_microbeats%(voic1%)+notes_to_microbeats%(tlen%)
ENDIF
IF (elapsed_microbeats%(voic1%)>next_bar_line%)
@new_bar_line
note_xposition%=next_note_xposition%
ENDIF
IF next_note_xposition%>595 THEN
@show
ELSE
@draw_note_on_staff(next_note_xposition%,1)
ENDIF
@sound_note
@update_editor_windows
IF kount%(voic1%)>vclen%(voic1%)
vclen%(voic1%)=kount%(voic1%)
' @show
ENDIF
ENDIF
IF klick%=2 ! right button for correcting the last note keyed in
tnote&(voic1%,kount%(voic1%))=nte%+tlen%*256
IF tlen%<>last_note_duration%(voic1%)
elapsed_microbeats%(voic1%)=elapsed_microbeats%(voic1%)-notes_to_microbeats%(last_note_duration%(voic1%))
elapsed_microbeats%(voic1%)=elapsed_microbeats%(voic1%)+notes_to_microbeats%(tlen%)
last_note_duration%(voic1%)=tlen%
ENDIF
@show
@sound_note
@update_editor_windows
ENDIF
ENDIF
IF klick%=0
@ascii_code_dispatcher
ENDIF
IF ky%=38
@execute_menu_command
ENDIF
IF ky%>33 AND ky%<37 !process repeat signs
draw_marker(ky%-32,next_note_xposition%)
INC kount%(voic1%)
IF kount%(voic1%)>vclen%(voic1%)
vclen%(voic1%)=kount%(voic1%)
ENDIF
tnote&(voic1%,kount%(voic1%))=256*(ky%-21)
ENDIF
NEXT i%
> PROCEDURE tnote_structure_doc
' tnote array stores the pitch and duration value of every note
' to be played for the three voices (tracks). The high byte contains
' the duration code and other special codes. The low byte contains
' the pitch code. The pitch code modulo 12 maps into the note letter
' c,c#,d,d#,... b. If the pitch code is zero then a rest is assumed.
' The duration code 0 to 12 map to note duration in the order that
' the note duration sprites appear in the menu. Other codes 13 to 15
' control repeats. Codes 16 and 17 are not fully implemented but allow
' the inclusion of long rests in a particular voice. Other codes are
' only used for the input /output files *.TUN for specifying key signature,
' time signature, and tempo.
RETURN
> PROCEDURE note_sprites_doc
' order of sprites in the sprite array is: 1 c-cleff, 2 bass-cleff
' 3 flat symbol for tail up note, 4 flat symbol for tail down, 5,6 sharp
' symbol (tail up and down), 7,8 whole note symbol, 9,10 half note symbol
' 11,12 quarter note symbol, 13,14 eighth note symbol, 15,16 sixteenth note
' 17,18 32nd node, 19-25 rest symbols, 26,27 natural symbol.
RETURN
> PROCEDURE load_note_sprites
LOCAL loop%
OPEN "i",#1,"notes2.put"
FOR loop%=1 TO 29
sprite$(loop%)=INPUT$(CVI(INPUT$(2,#1)),#1)
NEXT loop%
CLOSE #1
RETURN
> PROCEDURE read_music_data
@read_note_positions
@read_note_duration_sprite_numbers
@read_rest_duration_sprite_numbers
@read_key_to_letter_converter
@read_note_duration_code
@read_key_signature_representation
@read_order_of_flats_and_sharps
@read_signature_sharp_sequence
@read_timconv_array
@read_key_decoders
RETURN
> PROCEDURE read_note_positions
LOCAL i%
REM read the vertical position to display the note sprites on
REM the treble or bass staff.
REM negative numbers are pointers to sharp or flat notes.
FOR i%=1 TO 49
READ note_yposition%(i%)
NEXT i%
FOR i%=1 TO 21
READ flat_yposition%(i%)
NEXT i%
FOR i%=1 TO 20
READ sharp_yposition%(i%)
NEXT i%
DATA 67,-1,65,-2,62,-3,60,58,-4,55
DATA -5,63,61,-6,59,-7,56,-8,54,52
DATA -9,32,-10,30,28,-11,25,-12,23,-13
DATA 20,28,-14,26,-15,23,21,-16,19,-17
DATA 17,-18,15,13,-19,11,-20,9,-21
REM
DATA 65,62,60,55,63,59,57,54,32,30
DATA 25,23,20,26,23,19,17,15,11,9
DATA 7
REM
DATA 67,65,62,58,55,61,59,56,52,32
DATA 28,25,23,28,26,21,19,17,13,11
RETURN
> PROCEDURE read_note_duration_sprite_numbers
LOCAL i%
FOR i%=0 TO 12
READ length_sprite%(i%)
NEXT i%
DATA 17,15,13,13,11,11,9,9,7,7,17,15,13
ltlen%=4
RETURN
> PROCEDURE read_rest_duration_sprite_numbers
LOCAL i%
FOR i%=0 TO 12
READ rest_sprite%(i%)
NEXT i%
DATA 24,23,22,22,21,21,20,20,19,19,24,23,22
RETURN
> PROCEDURE read_key_to_letter_converter
LOCAL i%
FOR i%=1 TO 12
READ sharp_key_to_letter$(i%)
NEXT i%
FOR i%=1 TO 12
READ flat_key_to_letter$(i%)
NEXT i%
DATA "C","C#","D","D#","E","F","F#","G","G#","A","A#","B"
DATA "C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"
RETURN
> PROCEDURE read_note_duration_code
LOCAL i%
FOR i%=0 TO 17
READ dur